package com.example.demo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.example.demo.service.AdMainService;

@Controller
public class CompAdApproveController {
@Autowired
private AdMainService adMainService;

@RequestMapping("/ApproveCompetition")
public String approveCompetition(@RequestParam("OrganizersName") String OrganizersName,@RequestParam("CompetitionName") String CompetitionName,
								@RequestParam("CompetitionType") String CompetitionType,@RequestParam("CompetitionDate") String CompetitionDate,
								@RequestParam("CompetitionRemarks") String CompetitionRemarks,@RequestParam("CompetitionPrice") String CompetitionPrice,
								@RequestParam String action) {
	//点击同意事件
	if(action.equals("同意")) {
	adMainService.approveCompetition(OrganizersName, CompetitionName, CompetitionType, CompetitionDate, CompetitionRemarks, CompetitionPrice);
	}
	//点击拒绝事件
	if(action.equals("拒绝")) {
	adMainService.refuseCompetition(OrganizersName, CompetitionName, CompetitionType, CompetitionDate, CompetitionRemarks, CompetitionPrice);
}
	return "CompAdMain.html";
	}
}
